home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
diskutil
/
multicop.lzh
/
MULTICOP.FOR
next >
Wrap
Text File
|
1993-09-23
|
30KB
|
973 lines
C MULTICOP.FOR
C MULTICOP
C ESKIP
C FMTCOP
C ERROR
C SETSTA
C FEXIT
C AESSET
C DOFORM
C----------------------------------------------------------------------
C MULTICOP
C----------------------------------------------------------------------
C
C Program to fast format and copy to disks
C
C Read returns:
C A Initial entry
C B Abort read
C C Read error
C D Return form write form: write done
C E Exit from write form
C F End of HELP/ABORT
C G Boot block error
C H SPT/NTRACK error
C
C----------------------------------------------------------------------
C
PROGRAM MULTICOP
INCLUDE 'MULTICOP.INC'
INCLUDE 'MULTICOP.JNC'
C Local
INTEGER*1 BNSTR(12),PKR1
INTEGER*2 LINE(0:3),DL(0:7),PKR2(2)
INTEGER*4 form_do,form_alert,objc_state
INTEGER*4 I,J,K,K1,K2,XX,XXX,RES,RDRV,WDRV,NDRV,HANDLE
INTEGER*4 EVENT,evnt_multi,objc_find,PMX,PMY,PMB,PKS,PKR,PBR
INTEGER*4 IADSEC,NTRACK,ITRACK,IH,IS,IM,IDN,NN
INTEGER*4 PX,PY,CXA(0:1),CYA(0:1)
INTEGER*4 STATE(0:1)
CHARACTER NAME*8,NSTR*12,ZERO*1
CHARACTER*7 DISK(0:1)
EQUIVALENCE (BNSTR,NSTR),(PKR2,PKR),(PKR2(2),PKR1)
C Form parameters
INTEGER*4 OBJADD(0:NF),FX(0:NF),FY(0:NF),FW(0:NF),FH(0:NF)
COMMON /FRM/OBJADD,FX,FY,FW,FH
INTEGER*4 CADD,FADD,CX,CY,CW,CH,X,Y,W,H
INTEGER*4 IBUT,HBUT
EQUIVALENCE (CADD,OBJADD(0)),(FADD,OBJADD(1))
EQUIVALENCE (CX,FX(0)),(X,FX(1))
EQUIVALENCE (CY,FY(0)),(Y,FY(1))
EQUIVALENCE (CW,FW(0)),(W,FW(1))
EQUIVALENCE (CH,FH(0)),(H,FH(1))
INTEGER*1 SECTOR0(512,20,85),BUF(10000),BTBK(512)
INTEGER*1 SECTOR1(512,20,85)
INTEGER*4 SPT,SPD,NSIDES
INTEGER*4 WW,D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11
INTEGER*4 CDA1,CDA2,CDA3,CDA4,CDA5,CDA6,CDA7
INTEGER*4 CDA8,CDA9,CDA10,CDA11
INTEGER*4 CDB1,CDB2,CDB3,CDB4,CDB5,CDB6,CDB7
INTEGER*4 CDB8,CDB9,CDB10,CDB11
EQUIVALENCE (SECTOR0,BTBK)
LOGICAL*4 RANNUM
DATA NAME/'MULTICOP'/
DATA DISK/'Disk A ','Disk B '/
ZERO=CHAR(0)
DISK(0)(7:7)=ZERO
DISK(1)(7:7)=ZERO
C-------------------------------------------------------------MULTICOP
C Formats
1 FORMAT(I1)
2 FORMAT(I2)
4 FORMAT(I4)
10 FORMAT(I10)
C Initialise AES
CALL AESSET(HANDLE,NAME,-1,RES,OBJADD,FX,FY,FW,FH)
CALL graf_mouse(0,0)
CALL graf_mouse(256,0) !hide mouse
CALL objc_offset(FADD,READBAR,PX,PY)
CALL objc_offset(CADD,BARA,CXA(0),CYA(0))
CALL objc_offset(CADD,BARB,CXA(1),CYA(1))
C Initialise states
CALL objc_read(FADD,READBAR,D1,D2,D3,D4,D5,D6,D7,
1 D8,D9,D10,D11)
CALL objc_read(CADD,BARA,CDA1,CDA2,CDA3,CDA4,CDA5,CDA6,CDA7,
1 CDA8,CDA9,CDA10,CDA11)
CALL objc_read(CADD,BARB,CDB1,CDB2,CDB3,CDB4,CDB5,CDB6,CDB7,
1 CDB8,CDB9,CDB10,CDB11)
C Start with mouse showing
CALL graf_mouse(257,0)
C-------------------------------------------------------------------
C Set up read form
C Define read form; hide mouse
2000 CALL form_dial(0,0,0,0,0,X,Y,W,H) !open dialog box
C Hide mouse & clear read statistics and read button
CALL ESKIP(0,1,*2100) !Type A return
C Draw read form
2100 CALL objc_draw(FADD,0,32767,X,Y,W,H)
C--------------------------------------------------------------------
C Process read form
1000 CALL graf_mouse(257,0)
IBUT=form_do(FADD,0)
CALL graf_mouse(256,0)
IF (IBUT.NE.READIT)
1 CALL objc_change(FADD,IBUT,0,X,Y,W,H,0,.TRUE.)
C Analyse exits
C Abort
IF (IBUT.EQ.EXITR) THEN
CALL FEXIT(HANDLE,X,Y,W,H)
C Give help
ELSE IF (IBUT.EQ.HELP) THEN
CALL form_dial(3,0,0,0,0,X,Y,W,H) !close box
CALL DOFORM(2,HBUT,0)
IF (HBUT.EQ.MORE) CALL DOFORM(3,HBUT,0)
CALL form_dial(0,0,0,0,0,X,Y,W,H)
CALL objc_draw(FADD,0,32767,X,Y,W,H)
GOTO 1000 !Type F return
C Abort
ELSE IF (IBUT.EQ.ABORTR) THEN
GOTO 1000 !rType F return
C Read the disk
ELSE
C Get the disk
RDRV=objc_state(FADD,DISKB)
C Read the disk number flag
RANNUM=(objc_state(FADD,YESDN).GT.0)
C Read boot block of master disk
CALL FLOPRD(K,BTBK,RDRV,1,0,0,1)
IF (K.NE.0) THEN
I=form_alert(1,'[3][Error in boot block][Abort]')
CALL objc_change(FADD,IBUT,0,X,Y,W,H,0,.TRUE.)
GOTO 1000 !Type G return
END IF
IADSEC=IADDR(SECTOR0)
C Get Sectors/track: SPT
K1=(IPEEK1(IADSEC+25).AND.255)
CALL ISHFT(K1,K1,8)
K2=(IPEEK1(IADSEC+24).AND.255)
SPT=(K1.OR.K2)
C Get sectors/disk: SPD
K1=(IPEEK1(IADSEC+20).AND.255)
CALL ISHFT(K1,K1,8)
K2=(IPEEK1(IADSEC+19).AND.255)
SPD=(K1.OR.K2)
C Get number of sides: NSIDES
K1=(IPEEK1(IADSEC+27).AND.255)
CALL ISHFT(K1,K1,8)
K2=(IPEEK1(IADSEC+26).AND.255)
NSIDES=(K1.OR.K2)
C Get disk number
I=BTBK(9).AND.255
J=BTBK(10).AND.255
K=BTBK(11).AND.255
IDN=K+256*(J+256*I)
C Get number of tracks: NTRACK
NTRACK=SPD/(SPT*NSIDES)
C Display some statistics
C First drive name
CALL objc_newtext(FADD,SOURCE,DISK(RDRV))
CALL objc_draw(FADD,SOURCE,0,X,Y,W,H)
C Sectors/track
WRITE(NSTR(1:2),2) SPT
BNSTR(3)=0
CALL objc_newtext(FADD,SPTT,NSTR)
CALL objc_draw(FADD,SPTT,32767,X,Y,W,H)
C Sectors/disk
WRITE(NSTR(1:4),4) SPD
BNSTR(5)=0
CALL objc_newtext(FADD,SPDT,NSTR)
CALL objc_draw(FADD,SPDT,0,X,Y,W,H)
C Sides/disk
WRITE(NSTR(1:1),1) NSIDES
BNSTR(2)=0
CALL objc_newtext(FADD,SIPDT,NSTR)
CALL objc_draw(FADD,SIPDT,0,X,Y,W,H)
C Tracks/side
WRITE(NSTR(1:2),2) NTRACK
BNSTR(3)=0
CALL objc_newtext(FADD,TDDT,NSTR)
CALL objc_draw(FADD,TDDT,0,X,Y,W,H)
C Test SPT and NTRACK
IF (SPT.GT.11.OR.NTRACK.GT.85) THEN
IF (SPT.GT.11)
1 I=form_alert(1,'[3][Too many sectors/track][Abort]')
IF (NTRACK.GT.85)
1 I=form_alert(1,'[3][Too many tracks][Abort]')
CALL ESKIP(1,0,*1000) !Type H return
END IF
C Disk #
WRITE(NSTR(1:10),10) IDN
BNSTR(11)=0
CALL objc_newtext(FADD,DISKN,NSTR)
CALL objc_draw(FADD,DISKN,0,X,Y,W,H)
IF (RANNUM) THEN
CALL TIME(IH,IM,IS,IH)
XX=RANDOM(IM*60+IS)
END IF
C Set up progress bar X coordinate and box size
WW=2*NTRACK+1
IF (WW.NE.D10) THEN
CALL objc_write(FADD,READBAR,D1,D2,D3,D4,D5,D6,D7,
1 D8,D9,WW-2,D11)
CALL objc_draw(FADD,READBAR,0,X,Y,W,H)
CALL objc_write(CADD,BARA,CDA1,CDA2,CDA3,CDA4,CDA5,CDA6,
1 CDA7,CDA8,CDA9,WW,CDA11)
CALL objc_write(CADD,BARB,CDB1,CDB2,CDB3,CDB4,CDB5,CDB6,
1